package com.bolt.support.query.nativequery.parall;

import java.io.Serializable;

public class ParallelQueryConfig implements Serializable {
    /**
     * 最大等待时长(秒),默认30分钟
     */
    private Integer maxWaitSeconds = 1800;

    /**
     * 最大并行数量
     */
    private Integer maxThreads = 10;

    public static ParallelQueryConfig create() {
        return new ParallelQueryConfig();
    }

    /**
     * @return the maxWaitSeconds
     */
    public Integer getMaxWaitSeconds() {
        return maxWaitSeconds;
    }

    /**
     * @param maxWaitSeconds the maxWaitSeconds to set
     */
    public ParallelQueryConfig maxWaitSeconds(Integer maxWaitSeconds) {
        if (maxWaitSeconds != null && maxWaitSeconds > 0) {
            this.maxWaitSeconds = maxWaitSeconds;
        }
        return this;
    }

    /**
     * @return the maxThreads
     */
    public Integer getMaxThreads() {
        return maxThreads;
    }

    /**
     * @param maxThreads the maxThreads to set
     */
    public ParallelQueryConfig maxThreads(Integer maxThreads) {
        if (maxThreads != null && maxThreads > 0) {
            this.maxThreads = maxThreads;
        }
        return this;
    }
}